<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="UTF-8" />
    <title>Framework Delegate</title>
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"
    />
    <link href="../../../../../css/ionic.bundle.css" rel="stylesheet" />
    <link href="../../../../../scripts/testing/styles.css" rel="stylesheet" />
    <script src="../../../../../scripts/testing/scripts.js"></script>
    <script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script>
    <script type="module">
      import { modalController, createAnimation } from '../../../../../dist/ionic/index.esm.js';
      window.modalController = modalController;
    </script>
  </head>
  <body>
    <ion-app>
      <ion-modal id="inline-root" trigger="button-inline-root">
        <ion-content class="ion-padding"> Hello World </ion-content>
      </ion-modal>
      <div class="ion-page" id="main-content">
        <ion-header>
          <ion-toolbar>
            <ion-title>Modal - Inline</ion-title>
          </ion-toolbar>
        </ion-header>

        <ion-content class="ion-padding">
          <ion-button id="button-inline-root">Open inline modal at ion-app root</ion-button>
          <ion-button id="button-inline-content">Open inline modal inside of content</ion-button>
          <ion-button id="button-controller" onclick="createAndPresentModal()">Open controller modal</ion-button>

          <ion-modal id="inline-content" trigger="button-inline-content">
            <ion-content class="ion-padding"> Hello World </ion-content>
          </ion-modal>
        </ion-content>
      </div>
    </ion-app>

    <script>
      const createModal = async () => {
        const div = document.createElement('div');
        div.innerHTML = `
          <ion-content class="ion-padding">
            Hello World
          </ion-content>
        `;

        const modal = await modalController.create({
          component: div,
          id: 'controller',
        });

        return modal;
      };

      const createAndPresentModal = async () => {
        const modal = await createModal();
        await modal.present();
      };
    </script>
  </body>
</html>
